package com.zzg.springboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zzg.springboot.entity.UserEntity;
import com.zzg.springboot.service.UserEntityService;

@Controller
@RequestMapping("/api/springboot")
public class UserController {
	@Autowired
	private UserEntityService service;
	
	@RequestMapping(value="/one", method=RequestMethod.GET)
	@ResponseBody
	public UserEntity one(@RequestParam String name){
		System.out.println("第一次执行");
		UserEntity  one = service.selectById(name);
		System.out.println("id:" + one.getId() +",pwd:" + one.getPwd() +", name:" + one.getName() + ", address:" + one.getAddress());
		System.out.println("第二次执行");
		UserEntity  two =  service.selectById(name);
		System.out.println("id:" + two.getId() +",pwd:" + two.getPwd() +", name:" + two.getName() + ", address:" + two.getAddress());
		return two;
	}

}
